<template>
  <div class="lottery d-flex space-center">
    <van-icon name="cross" class="close" @click="closeDialog"></van-icon>
    <p v-for="(item, index) in detail.lb_des" :key="index">{{ item }}</p>
    <div class="header">
      <p class="title">{{ detail.lb_name }}</p>
      <p class="result">{{ detail.lb_gb }}</p>
    </div>
    <div class="share d-flex flex-end">
      <button open-type="share" id="share-lottery-result">
        <i class="iconfont icon-weixin"></i>
      </button>
      <!-- <button @click="share">
        <i class="iconfont icon-pengyouquan"></i>
      </button>
      <canvas class=".canvas" canvas-id="myCanvas" style="width:100%;height:568px;"></canvas> -->
    </div>
  </div>
</template>
<script>
export default {
  props: {
    lottery: {
      type: Object,
      default: () => {}
    }
  },
  data () {
    return {
      detail: {}
    }
  },
  watch: {
    lottery: {
      handler (val) {
        this.detail = {...val}
        this.detail.lb_des = this.detail.lb_des.replace(/。/g, ' ').split(' ').slice(0, 8)
      }
    }
  },
  methods: {
    // 关闭弹框
    closeDialog () {
      this.$emit('close-dialog')
    }
  }
}
</script>
<style lang="scss" scoped>
.lottery {
  height: 400px;
  padding: 30px 10px;
  position: relative;
  // background: url('https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1564657844275&di=dc14fb5f3f9987b5af5c06983dd84dcf&imgtype=0&src=http%3A%2F%2Fs9.sinaimg.cn%2Fmw690%2F006wiJRrzy7hVXndbQY68%26690') no-repeat center center / cover;
  > p {
    writing-mode: vertical-rl;
    font-family: '微软雅黑';
    text-align: justify;
    font-size: 18px;
    letter-spacing: 5px;
  }
  .close {
    position: absolute;
    top: 5px;
    left: 5px;
  }
  .header {
    margin-left: 15px;
    .title {
      writing-mode: vertical-rl;
      font-size: 28px;
      font-weight: bold;
    }
    .result {
      writing-mode: vertical-rl;
      background: red;
      color: #fff;
      font-size: 28px;
      font-weight: bold;
      padding: 10px 0;
      margin: 10px 0;
    }
  }
  .share {
    position: absolute;
    bottom: 20px;
    right: 20px;
  }
}
</style>

